<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the number of rows in a buffered result set</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-num-fields.html">sqlite_num_fields</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-open.html">sqlite_open</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.sqlite-num-rows" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlite_num_rows</h1>
  <h1 class="refname">SQLiteResult::numRows</h1>
  <p class="verinfo">(PHP 5 &lt; 5.4.0, PECL sqlite &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_num_rows</span> -- <span class="refname">SQLiteResult::numRows</span> &mdash; <span class="dc-title">Returns the number of rows in a buffered result set</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sqlite-num-rows-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>sqlite_num_rows</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result</code></span>
   )</div>

  <p class="para rdfs-comment">面向对象风格 (method):</p>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>SQLiteResult::numRows</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Returns the number of rows in the buffered <em><code class="parameter">result</code></em>
   set.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sqlite-num-rows-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">result</code></em></dt>

     <dd>

      <p class="para">
       The SQLite result resource.  This parameter is not required when using
       the object-oriented method.
      </p>
      <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">此函数不能用于未缓冲的结果句柄。</p></p></blockquote>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sqlite-num-rows-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the number of rows, as an integer.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.sqlite-num-rows-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2084">
    <p><strong>Example #1 Procedural example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$db&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlite_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'mysqlitedb'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlite_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$db</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;mytable&nbsp;WHERE&nbsp;name='John&nbsp;Doe'"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$rows&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlite_num_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"Number&nbsp;of&nbsp;rows:&nbsp;</span><span style="color: #0000BB">$rows</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2085">
    <p><strong>Example #2 Object-oriented example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$db&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SQLiteDatabase</span><span style="color: #007700">(</span><span style="color: #DD0000">'mysqlitedb'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;mytable&nbsp;WHERE&nbsp;name='John&nbsp;Doe'"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$rows&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">numRows</span><span style="color: #007700">();<br /><br />echo&nbsp;</span><span style="color: #DD0000">"Number&nbsp;of&nbsp;rows:&nbsp;</span><span style="color: #0000BB">$rows</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sqlite-num-rows-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.sqlite-changes.html" class="function" rel="rdfs-seeAlso">sqlite_changes()</a> - Returns the number of rows that were changed by the most
   recent SQL statement</span></li>
    <li class="member"><span class="function"><a href="function.sqlite-query.html" class="function" rel="rdfs-seeAlso">sqlite_query()</a> - Executes a query against a given database and returns a result handle</span></li>
    <li class="member"><span class="function"><a href="function.sqlite-num-fields.html" class="function" rel="rdfs-seeAlso">sqlite_num_fields()</a> - Returns the number of fields in a result set</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-num-fields.html">sqlite_num_fields</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-open.html">sqlite_open</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
